package com.genius.unite_platform.pandian_plan_jd;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.genius.dingding.util.GeniusConfig;
import com.genius.mobile_page.common.ErrorResponseData;
import com.genius.mobile_page.common.ResponseData;
import com.genius.mobile_page.common.SuccessResponseData;
import com.genius.mobile_page.pandian_jd.pandianjdUtil;
import com.genius.workflow.util.DBTools2;

import cn.hutool.core.util.ObjectUtil;

public class Pandian_plan_jdUtil {
	public static ResponseData planZuofei(String shopcode, String pandianDate) {
		try {
			DBTools2.update("update pandian_jiancha_jd set flag = '-1' where shopcode = ? and pandianDate = ?"
					,new String[]{shopcode,pandianDate});
			
			return new SuccessResponseData();
			
			
		} catch (SQLException throwables) {
			
			throwables.printStackTrace();
			return new ErrorResponseData("盘点作废失败");
		} catch (Exception e) {
			e.printStackTrace();
			return new ErrorResponseData(e.getMessage());
		}
	}
	public static ResponseData planZuofei(JSONArray idArray) {
		try {
			List<String[]> parms = new ArrayList<String[]>();
			for (int i = 0; i < idArray.size(); i++) {
				parms.add(new String[]{idArray.getString(i)});
			}
			DBTools2.updateBatch("update pandian_jiancha_jd set flag = '-1' where shopcode,pandianDate"
    				+ " in (select shopcode,pandianDate from pandian_plan_jd where id = ?)"
					,parms);
			
			return new SuccessResponseData();
			
			
		} catch (SQLException throwables) {
			
			throwables.printStackTrace();
			return new ErrorResponseData("盘点作废失败");
		} catch (Exception e) {
			e.printStackTrace();
			return new ErrorResponseData(e.getMessage());
		}
	}
}
